/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.businesslogic;

import cn.ekuma.epos.datalogic.I_DataLogicSales;
import com.openbravo.bean.Rant;
import java.util.Date;

/**
 *
 * @author Administrator
 */
public class RantUtil {
    public static void changeRantState(I_DataLogicSales m_dlSales,Rant theRant,String state){
        if(Rant.RANTSTATE_noRant.equalsIgnoreCase(state)){
            theRant.setRantState(Rant.RANTSTATE_rant);
        }else if(Rant.RANTSTATE_rant.equalsIgnoreCase(state)){
            theRant.setReturnData(new Date());
            theRant.setRantState(Rant.RANTSTATE_returned);
        }
    }

    public static boolean isRantStateChangeAble(I_DataLogicSales m_dlSales,Rant theRant,String state){
        if(Rant.RANTSTATE_noRant.equalsIgnoreCase(state)&&(theRant.getM_sId()!=null||!theRant.getM_sId().isEmpty())){
            return true;
        }else if(Rant.RANTSTATE_rant.equalsIgnoreCase(state)){
          return true;
        }
        return false;
    }
}
